package com.zimmur.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zimmur.quartz.ProcessOrganizationEnd;
import com.zimmur.quartz.ProcessPushMessage;
import com.zimmur.service.account.ICouponService;

@RestController
@RequestMapping("/restful")
public class RestfulController extends BaseController {
	private static Logger log=LoggerFactory.getLogger(RestfulController.class);
	@Resource
	private ProcessOrganizationEnd ProcessOrganizationEnd;
	@Resource
	private ProcessPushMessage ProcessPushMessage;
	
	@Resource
	private ICouponService couponService;
	
	@ResponseBody
	@RequestMapping(value="/test")  
    public String test(HttpServletRequest request,Model model){		
        /*int userId = Integer.parseInt(request.getParameter("id"));  
        System.out.println("userId:"+userId);
        User user=null;
        if (userId==1) {
        	 user = new User();  
        	 user.setAge(11);
        	 user.setId(1);
        	 user.setPassword("123");
        	 user.setUserName("javen");
		}
        log.debug(user.toString());
        model.addAttribute("user", user);  

         */
//		System.out.println(getTokenUserId());
//		System.out.println("-----------------");
		String mobileNo=getParam("mobileNo");
		try {
			log.info(mobileNo);
			couponService.createCouponByMobileNo(mobileNo, "other");
			return "success";
		} catch (Exception e) {
			log.error(e.getMessage(),e);
		}
		return "";
    }  
}
